package com.ailk.tcm.hffw.android.common.ui;

import com.ailk.tcm.R;

import android.content.Context;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

public class FooterView extends LinearLayout{
	
	private ProgressBar progressBar;
	
	public FooterView(Context context) {
		super(context);
		
		LinearLayout contentLayout = new LinearLayout(context);
		contentLayout.setOrientation(LinearLayout.HORIZONTAL);
	       
        //添加进展条
        progressBar = new ProgressBar(context);
        progressBar.setPadding(0, 0, 15, 0);
        contentLayout.addView(progressBar, new LinearLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
       
        //添加文字，设置文字垂直居中
        TextView textView = new TextView(context);
        textView.setText(R.string.loading);
        textView.setGravity(Gravity.CENTER_VERTICAL);
        contentLayout.addView(textView, new LinearLayout.LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT));
       
        //同时将进展条和加载文字显示在中间
        contentLayout.setGravity(Gravity.CENTER);
       
        addView(contentLayout, new LinearLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
       
        setGravity(Gravity.CENTER);
	}
}
